package com.sevennotes.classtable.data.database.daos

import androidx.lifecycle.LiveData
import androidx.room.*
import com.sevennotes.classtable.model.ClassAmountRecord

@Dao
interface ClassAmountRecordDAO {
    @Insert
     fun insertClassAmount(classAmountRecord: ClassAmountRecord)

    @Delete
     fun deleteClassAmount(classAmountRecord: ClassAmountRecord)

    @Update
     fun updateClassAmount(classAmountRecord: ClassAmountRecord)

     @Query("DELETE FROM class_amount_record")
     fun clear()

     @Query("SELECT * FROM class_amount_record")
     fun getAllCARForBack():List<ClassAmountRecord>

    @Query("SELECT * FROM class_amount_record WHERE student_id = :studentId")
     fun getAllClassAmountByStudentId(studentId: Int):LiveData<List<ClassAmountRecord>>

    @Query("SELECT * FROM class_amount_record WHERE student_id = :studentId")
    fun getAllById(studentId: Int):List<ClassAmountRecord>

    @Query("DELETE FROM class_amount_record WHERE student_id = :studentId")
     fun deleteAllByStudentId(studentId: Int)
}